<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
	<title>网络新闻管理系统</title>
	
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="this is my page">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	
	<link rel="stylesheet" type="text/css" href="/res/style/common.css">
	<link rel="stylesheet" type="text/css" href="/res/style/admin.css">
	<link rel="stylesheet" type="text/css" href="/res/style/userManage.css">
	<script type="text/javascript" src="/res/script/menu.js"></script>
	<script type="text/javascript" src="/res/script/userManage.js"></script>
  </head>
  
  <body onload="addMenu();">
	<div class="MainDiv">
		<div class="AjustDiv">
			<jsp:include page="/page/admin/adminHeader.jsp"></jsp:include>
			<jsp:include page="/page/admin/adminLeft.html"></jsp:include>
			<!-- 内容部分 -->
			<div class="ContentDiv">
				<div class="RowDiv">
					<div class="HeaderButtonDiv">
						<div class="ChangePageDiv">
							<table>
								<tr>
									<td>
										<a onclick="">首页</a>
									</td>
									<td>
										<a onclick="">上一页</a>
									</td>
									<td>
										<a onclick="">1</a>
									</td>
									<td>
										<a onclick="">2</a>
									</td>
									<td>
										<a onclick="">3</a>
									</td>
									<td>
										<a onclick="">下一页</a>
									</td>
									<td>
										<a onclick="">尾页</a>
									</td>
								</tr>
							</table>
						</div>
						<input type="button" onclick="addUser();" name="" value="添加"/>
						
					</div>
					<table>
						<tr>
							<td><label class="TableHeader">序号</label></td>
							<td><label class="TableHeader">账号</label></td>
							<td><label class="TableHeader">昵称</label></td>
							<td><label class="TableHeader">角色</label></td>
							<td><label class="TableHeader">账号可用</label></td> 
							<c:if test="${ user != null && user.role.id == 1}">
								<td><label class="TableHeader">重置密码</label></td>
							</c:if>
							<td><label class="TableHeader">注册时间</label></td>
							<td colspan="3"><label class="TableHeader">操作</label></td>
						</tr>
						
						<c:forEach items="${users }" var="u" varStatus="status">
							<tr>
								<td><label>${status.index + 1}</label></td>
								<td><label>${u.username}</label></td>
								<td><label>${u.nickname}</label></td>
								<td><select id="id_RoleSelecter_${u.username}" name="user.role.id">
										<option value="1" <c:if test="${u.role.id == 1 }">selected="selected"</c:if>>高级管理员</option>
										<option value="2" <c:if test="${u.role.id == 2 }">selected="selected"</c:if>>管理员</option>
										<option value="3" <c:if test="${u.role.id == 3 }">selected="selected"</c:if>>采集员</option>
										<option value="4" <c:if test="${u.role.id == 4 }">selected="selected"</c:if>>VIP用户</option>
										<option value="5" <c:if test="${u.role.id == 5 }">selected="selected"</c:if>>普通用户</option>
			
								</select></td>
								<td><select id="id_StateSelecter_${u.username}" name="user.state">
										<option value="1" <c:if test="${u.state == 1 }">selected="selected"</c:if>>是</option>
										<option value="0" <c:if test="${u.state != 1 }">selected="selected"</c:if>>否</option>
								</select>
								</td> 
								<c:if test="${user != null && user.role.id == 1 }">
									<td><a href="javascript:void(0)" onclick="resetPw(this);" name="${u.username}">重置</a></td> 
								</c:if>
								<td><label>${u.registerTime}</label></td>
								<td><a href="javascript:void(0)" onclick="update(this);" name="${u.username}">更改</a></td>
								<td><a href="javascript:void(0)" onclick="deleteUser(this);" name="${u.username}">删除</a></td>
								<td><a href="javascript:void(0)" onclick="detail(this);" name="${u.username}">详细</a></td>
							</tr>
						</c:forEach>
					</table>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="/page/admin/adminFooter.html"></jsp:include>
  </body>
</html>
